
capture log close
cd "/Users/johnmcandrews/Loewen-RubensonLab Dropbox/LR Research Lab - Shared/Papers/Senate Paper/Analysis/LSQ-Replication"
log using senate-replication-analysis.log, replace text

//  program:    senate-replication-analysis.do

//  tasks:	
//		Analysis of senate-replication-anonymized_responses.dta 
//		(anonymized dataset of senators' stacked responses)
//		Analysis of senate-replication-anonymized_counts.dta 
//		(anonymized dataset of counts of senators' responses)
//		Analysis senate-replication-anonymized_allinvitees.dta 
//		(anonymized dataset of all senators invited to the survey)

//  project:	LSQ Article "Non-electoral Motivations to Represent 
//		Marginalized Groups in a Democracy: Evidence from an unelected 
//		legislature"

//  last modified:     JM \ 2020-OCT-04

***Please note that the underlying data will not be publicly released
***in order to avoid identifying study participants

//	This do-file requires the following user-written packages:
//	spost13 (for -mgen- command)
//	estout (for outputting tables)
//	plottig (for graphing scheme)

version 14
clear all
set linesize 100
set scheme plottig


********************************************************************
**	Analysis of senate-replication-anonymized_responses.dta
********************************************************************

use senate-replication-anonymized_responses.dta

describe, full

codebook

***USING 4-CATEGORY REGION VARIABLE

eststo: mlogit choice4cat ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
//	multinomial logit model with standard errors clustered by senator
//	SI, Pages 15-16

esttab using "senate-analysis.rtf", replace ///
	se unstack label nonumbers nomtitles nobaselevels noomitted ///
	title("Multinomial Logit Estimates of Data Choice (4-category region model)") ///
	addnotes("The 'By Province' data choice is the base outcome of the dependent variable.")



//	Stacked bar graph for senator race/ethnicity
//	Main text, Figure 3

mgen, at(nonwhite = (0 1)) stub(pnon) replace

lab var pnonpr1 "Prov"
lab var pnonpr2 "Vote"
lab var pnonpr3 "Ethn/Indig"
lab var pnonpr4 "Gender"
lab val pnonnonwhite nonwhite

graph bar (asis) pnonpr1 pnonpr2 pnonpr3 pnonpr4, ///
	over(pnonnonwhite) stack ///
	title("Predicted Probability of Opinion Choice") ///
	subtitle("By Senator Race/Ethnicity") ///
	legend(order (4 3 2 1)) ///
	blabel(bar, position(center) format(%4.2f) color(white) size(small)) ///
	note("Predicted probabilities obtained from 4-category region model.") ///
	name(cat4region_pnon, replace)
	
graph export cat4region_pnon.pdf, name(cat4region_pnon) replace

graph drop _all
	
drop pnon*



//	Stacked bar graph for senator gender
//	Main text, Figure 4

mgen, at(female = (0 1)) stub(pfem) replace

lab var pfempr1 "Prov"
lab var pfempr2 "Vote"
lab var pfempr3 "Ethn/Indig"
lab var pfempr4 "Gender"
lab val pfemfemale female

graph bar (asis) pfempr1 pfempr2 pfempr3 pfempr4, ///
	over(pfemfemale) stack ///
	title("Predicted Probability of Opinion Choice") ///
	subtitle("By Senator Gender") ///
	legend(order (4 3 2 1)) ///
	blabel(bar, position(center) format(%4.2f) color(white) size(small)) ///
	note("Predicted probabilities obtained from 4-category region model.") ///
	name(cat4region_pfem, replace)
	
graph export cat4region_pfem.pdf, name(cat4region_pfem) replace

graph drop _all
	
drop pfem*



//	Stacked bar graph for senator region
//	Main text, Figure 5

mgen, at(region = (0 1 2 3)) stub(preg) replace

lab var pregpr1 "Prov"
lab var pregpr2 "Vote"
lab var pregpr3 "Ethn/Indig"
lab var pregpr4 "Gender"
lab val pregregion region

graph bar (asis) pregpr1 pregpr2 pregpr3 pregpr4, ///
	over(pregregion) stack ///
	title("Predicted Probability of Opinion Choice") ///
	subtitle("By Senator Region") ///
	legend(order (4 3 2 1)) ///
	blabel(bar, position(center) format(%4.2f) color(white) size(small)) ///
	note("Predicted probabilities obtained from 4-category region model.") ///
	name(cat4region_preg, replace)
	
graph export cat4region_preg.pdf, name(cat4region_preg) replace

graph drop _all
	
drop preg*	

	
	
//	Stacked bar graph for senator party affiliation
//	Main text, Figure 6
	
mgen, at(party_cat = (0 1 2)) stub(ppty) replace

lab var pptypr1 "Prov"
lab var pptypr2 "Vote"
lab var pptypr3 "Ethn/Indig"
lab var pptypr4 "Gender"
lab val pptyparty_cat party_cat

graph bar (asis) pptypr1 pptypr2 pptypr3 pptypr4, ///
	over(pptyparty_cat) stack ///
	title("Predicted Probability of Opinion Choice") ///
	subtitle("By Senator Party Affiliation") ///
	legend(order (4 3 2 1)) ///
	blabel(bar, position(center) format(%4.2f) color(white) size(small)) ///
	note("Predicted probabilities obtained from 4-category region model.") ///
	name(cat4region_ppty, replace)
	
graph export cat4region_ppty.pdf, name(cat4region_ppty) replace

graph drop _all
	
drop ppty*



eststo clear	


***Change in predicted probability for nonwhite
//	SI, Page 17
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(nonwhite) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Race/Ethnicity on Data Choice (Based on 4-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of white senator.")

eststo clear



***Change in predicted probability for female
//	SI, Page 17
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(female) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Gender on Data Choice (Based on 4-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of male senator.")

eststo clear	

	
	
***Change in predicted probability for region
//	SI, Page 17
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(region) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Region on Data Choice (Based on 4-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of Ontario senator.")

eststo clear
	
	
	
***Change in predicted probability for party_cat
//	SI, Page 17
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(party_cat) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Party on Data Choice (Based on 4-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of Independent senator.")

eststo clear	



***Change in predicted probability for age_centered
//	SI, Page 18
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(age_centered) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Age on Data Choice (Based on 4-category region model)") ///
	addnotes("Cells contain the average marginal effect of age on the predicted probability of the data choice.")

eststo clear



***USING 2-CATEGORY REGION VARIABLE

eststo: mlogit choice4cat ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
//	multinomial logit model with standard errors clustered by senator
//	SI, Page 19

esttab using "senate-analysis.rtf", append ///
	se unstack label nonumbers nomtitles nobaselevels noomitted ///
	star(+ 0.10 * 0.05) ///
	title("Multinomial Logit Estimates of Data Choice (2-category region model)") ///
	addnotes("The 'By Province' data choice is the base outcome of the dependent variable.")
	
eststo clear



***Change in predicted probability for nonwhite
//	SI, Page 20
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(nonwhite) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Race/Ethnicity on Data Choice (Based on 2-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of white senator.")

eststo clear



***Change in predicted probability for female
//	SI, Page 20
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(female) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Gender on Data Choice (Based on 2-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of male senator.")

eststo clear	
	


***Change in predicted probability for outontario
//	SI, Page 20
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(outontario) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Region on Data Choice (Based on 2-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of Ontario senator.")

eststo clear		

	

***Change in predicted probability for party_cat
//	SI, Page 20
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(party_cat) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Party on Data Choice (Based on 2-category region model)") ///
	addnotes("Cells contain the discrete change in the predicted probability of the data choice from the base level of Independent senator.")

eststo clear	
	

	
***Change in predicted probability for age_centered
//	SI, Page 21
	
foreach o in 1 2 3 4 {

	quietly:  mlogit choice4cat ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, baseoutcome(1) cluster(senator_id)
	
	if `o' == 1 {
	local outcomelbl "Prov"
	}

	if `o' == 2 {
	local outcomelbl "Vote"
	}

	if `o' == 3 {
	local outcomelbl "Ethn/Indig"
	}
	
	if `o' == 4 {
	local outcomelbl "Gender"
	}
	
	margins, dydx(age_centered) predict(outcome (`o')) numerical post
	eststo, title(`outcomelbl')

}
	
esttab using "senate-analysis.rtf", append ///
	p star(+ 0.10 * 0.05) label nonumbers mtitles nobaselevels noobs ///
	title("Impact of Age on Data Choice (Based on 2-category region model)") ///
	addnotes("Cells contain the average marginal effect of age on the predicted probability of the data choice.")

eststo clear





***	OUTPUT RAW CROSS-TABS OF DATA CHOICE

***By race/ethnicity
//	SI, Page 22

tab choice4cat nonwhite, col

estpost tab choice4cat nonwhite

esttab using "senate-analysis.rtf", append ///
	cells("colpct(label(%) fmt(2)) b(fmt(g) par)") ///
	collabels(none) unstack noobs nonumber nomtitle ///
	eqlabels(`e(eqlabels)') varlabels(`e(labels)') ///
	title("Data Choice by Senator Race/Ethnicity") ///
	addnote("Cells are column percentages; N appears in parentheses to the right.")
	
eststo clear



***By gender
//	SI, Page 22

tab choice4cat female, col

estpost tab choice4cat female

esttab using "senate-analysis.rtf", append ///
	cells("colpct(label(%) fmt(2)) b(fmt(g) par)") ///
	collabels(none) unstack noobs nonumber nomtitle ///
	eqlabels(`e(eqlabels)') varlabels(`e(labels)') ///
	title("Data Choice by Senator Gender") ///
	addnote("Cells are column percentages; N appears in parentheses to the right.")
	
eststo clear



***By 4-category region
//	SI, Page 22

tab choice4cat region, col

estpost tab choice4cat region

esttab using "senate-analysis.rtf", append ///
	cells("colpct(label(%) fmt(2)) b(fmt(g) par)") ///
	collabels(none) unstack noobs nonumber nomtitle ///
	eqlabels(`e(eqlabels)') varlabels(`e(labels)') ///
	title("Data Choice by Senator Region (4-category region variable)") ///
	addnote("Cells are column percentages; N appears in parentheses to the right.")
	
eststo clear



***By 2-category region
//	SI, Page 22

tab choice4cat outontario, col

estpost tab choice4cat outontario

esttab using "senate-analysis.rtf", append ///
	cells("colpct(label(%) fmt(2)) b(fmt(g) par)") ///
	collabels(none) unstack noobs nonumber nomtitle ///
	eqlabels(`e(eqlabels)') varlabels(`e(labels)') ///
	title("Data Choice by Senator Region (2-category region variable)") ///
	addnote("Cells are column percentages; N appears in parentheses to the right.")
	
eststo clear



***By party
//	SI, Page 23

tab choice4cat party_cat, col

estpost tab choice4cat party_cat

esttab using "senate-analysis.rtf", append ///
	cells("colpct(label(%) fmt(2)) b(fmt(g) par)") ///
	collabels(none) unstack noobs nonumber nomtitle ///
	eqlabels(`e(eqlabels)') varlabels(`e(labels)') ///
	title("Data Choice by Senator Party") ///
	addnote("Cells are column percentages; N appears in parentheses to the right.")
	
eststo clear



clear



********************************************************************
**	Analysis of senate-replication-anonymized_counts.dta
********************************************************************

use senate-replication-anonymized_counts.dta

describe, full

codebook


***USING 4-CATEGORY REGION VARIABLE
// SI, Page 24
	
eststo: nbreg prov_count ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, robust

eststo: nbreg vote_count ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, robust

eststo: nbreg ethnindig_count ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, robust

eststo: nbreg gender_count ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, robust
	
esttab using "senate-analysis.rtf", append ///
	se label nonumbers nobaselevels noomitted ///
	star(+ 0.10 * 0.05) ///
	title("Negative Binomial Estimates of the Number of Times Senators Chose Each Type of Data Choice (4-category region model)") ///
	addnote("Robust standard errors in parentheses")

eststo clear	
	
//	The negative binomial model for ethnindig_count model showed 
//	no evidence of overdispersion (a very small alpha parameter.)
//	Re-estimation using a Poisson regression model (below) 
//	yields identical estimates.

eststo: poisson ethnindig_count ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, vce(robust)

esttab using "senate-analysis.rtf", append ///
	se label nonumbers nobaselevels noomitted ///
	star(+ 0.10 * 0.05) ///
	title("Poisson Estimates of the Number of Times Senators Chose the Ethnicity/Indigenous Identity Data Choice (4-category region model)") ///
	addnote("Robust standard errors in parentheses")

eststo clear



***USING 2-CATEGORY REGION VARIABLE
//	SI, Page 25

eststo: nbreg prov_count ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, robust
	
eststo: nbreg vote_count ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, robust

eststo: nbreg ethnindig_count ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, robust

eststo: nbreg gender_count ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, robust
	
esttab using "senate-analysis.rtf", append ///
	se label nonumbers nobaselevels noomitted ///
	star(+ 0.10 * 0.05) ///
	title("Negative Binomial Estimates of the Number of Times Senators Chose Each Type of Data Choice (2-category region model)") ///
	addnote("Robust standard errors in parentheses")

eststo clear	
	
//	The negative binomial model for ethnindig_count model showed 
//	no evidence of overdispersion (a very small alpha parameter.)
//	Re-estimation using a Poisson regression model (below) 
//	yields identical estimates.

eststo: poisson ethnindig_count ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, vce(robust)
	
esttab using "senate-analysis.rtf", append ///
	se label nonumbers nomtitle nobaselevels noomitted ///
	star(+ 0.10 * 0.05) ///
	title("Poisson Estimates of the Number of Times Senators Chose the Ethnicity/Indigenous Identity Data Choice (2-category region model)") ///
	addnote("Robust standard errors in parentheses")

eststo clear
		


***SAMPLE DESCRIPTIVE STATISTICS OF SENATORS WHO PARTICIPATED


***BY RACE/ETHNICITY
//	SI, Page 11

estpost tab nonwhite

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Race/Ethnicity -- Sample Only")



***BY GENDER
//	SI, Page 11
	
estpost tab female

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Gender -- Sample Only")



***BY REGION
//	SI, Page 11
	
estpost tab region

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Region -- Sample Only")



***BY PARTY
//	SI, Page 11

estpost tab party_cat

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Party -- Sample Only")



***BY AGE (CENTERED)
//	SI, Page 11
	
estpost sum age_centered

esttab using "senate-analysis.rtf", append ///
	cells("mean sd min max") nomtitle nonumber ///
	title("Summary of Senators' Age (Centered) -- Sample Only")

eststo clear



***NUMBER OF RESPONSES BY SENATOR
//	SI, Page 13

estpost tab freqresp

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of the Number of Responses by Senator")



clear

********************************************************************
**	Analysis senate-replication-anonymized_allinvitees.dta
********************************************************************

use senate-replication-anonymized_allinvitees.dta

describe, full

codebook


***DESCRIPTIVE STATISTICS OF ALL SENATORS AT TIME OF STUDY

***BY RACE/ETHNICITY
//	SI, Page 12
	
estpost tab nonwhite

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Race/Ethnicity -- Full Senate")



***BY GENDER
//	SI, Page 12 
	
estpost tab female

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Gender -- Full Senate")



***BY REGION
//	SI, Page 12
	
estpost tab region

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Region -- Full Senate")
	


***BY PARTY
//	SI, Page 12

estpost tab party_cat

esttab using "senate-analysis.rtf", append ///
	cells("b(label(freq)) pct(fmt(2))") ///
	label nonumber nomtitle noobs varlabels(`e(labels)') ///
	title("Distribution of Senators by Party -- Full Senate")



***BY AGE (CENTERED)
//	SI, Page 12
	
estpost sum age_centered

esttab using "senate-analysis.rtf", append ///
	cells("mean sd min max") nomtitle nonumber ///
	title("Summary of Senators' Age (Centered) -- Full Senate")

eststo clear





***NEGATIVE BINOMIAL MODELS OF PARTICIPATION IN STUDY

gen freqresp_all = freqresp

replace freqresp_all = 0 if freqresp == .

tab freqresp_all, m



***USING 4-CATEGORY REGION VARIABLE
//	SI, Page 14

eststo: nbreg freqresp_all ib0.party_cat ib0.region ///
	ib0.female ib0.nonwhite c.age_centered, robust

esttab using "senate-analysis.rtf", append ///
	se label nonumbers nomtitles nobaselevels ///
	star(+ 0.10 * 0.05) ///
	title("Negative Binomial Estimates of Participation in Study, 4-category region model") ///
	addnote("Robust standard errors in parentheses")

eststo clear



***USING 2-CATEGORY REGION VARIABLE
//	SI, Page 15

eststo: nbreg freqresp_all ib0.party_cat ib0.outontario ///
	ib0.female ib0.nonwhite c.age_centered, robust

esttab using "senate-analysis.rtf", append ///
	se label nonumbers nomtitles nobaselevels ///
	star(+ 0.10 * 0.05) ///
	title("Negative Binomial Estimates of Participation in Study, 2-category region model") ///
	addnote("Robust standard errors in parentheses")

eststo clear
	


log close

exit
